<?php
function p($str){
	echo "<pre>";
	print_r($str);
	echo "</pre>";
}
function getTheSig($api_key,$api_secret,$calid){
	if($api_key != "" && $api_secret != ""){
		$sig = 'api_key='.$api_key.'call_id='.$calid.'format=jsonmethod=users.getLoggedInUsersession_key='.$_SESSION['session_key'].'v=1.0';
		//		$sig = str_replace('":"',"=",$sig);
		//		$sig = str_replace('","',"",$sig);
		//		$sig = str_replace('"',"",$sig);
		$sig = $sig.$api_secret;
		$sig = md5($sig);
		return $sig;
	}else{
		return "";
	}
}
function getSig($param){
	$sig='';
	ksort($param);
	foreach($param as $k=>$v)	$sig.=$k.'='.$v;
	$sig = md5($sig.SECRET);
	return $sig;
}
function getUserInfoSig($api_key,$api_secret,$session_key,$uids){
	if($api_key != "" && $api_secret != ""){
		$sig = '"api_key":"'.$api_key.'","call_id":"'.time().'","format":"json","method":"users.getInfo","session_key":"'.$session_key.'","uids":"'.$uids.'","v":"1.0"';
		$sig = str_replace('":"',"=",$sig);
		$sig = str_replace('","',"",$sig);
		$sig = str_replace('"',"",$sig);
		$sig = $sig.$api_secret;
		$sig = md5($sig);
		return $sig;
	}else{
		return "";
	}
}
?>